package com.vue.vuedemo.controller;

import com.vue.vuedemo.annotation.CheckToken;
import com.vue.vuedemo.map.ThumimgsMapper;
import com.vue.vuedemo.pojo.thumimages;
import com.vue.vuedemo.viewpojo.ResList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
public class ThumimgsController {
    @Autowired
    ThumimgsMapper thumimgsMapper;

    @CheckToken
    @GetMapping("/getthumimages/{id}")
    public ResList<thumimages> getthumimages(HttpServletResponse response,@PathVariable("id") Integer id){
        response.setHeader("Access-Control-Allow-Origin", "*");
        List<thumimages> imgsByImgid = thumimgsMapper.getImgsByImgid(id);
        
        ResList<thumimages> resList = new ResList<thumimages>();
        resList.setStatus(0);
        resList.setMessage(imgsByImgid);
        
        
        return resList;
    }

}
